{include file="public/header"}

<body>
    {if $business <= 0} <div class="layadmin-tips">
        <i class="layui-icon" face>&#xe664;</i>
        <div class="layui-text" style="font-size: 20px;">
            未绑定商家
        </div>
        </div>
        {/if}
        {if count($good) <= 0} <div class="layadmin-tips">
            <i class="layui-icon" face>&#xe664;</i>
            <div class="layui-text" style="font-size: 20px;">
                商家未添加服务
            </div>
            </div>
            {/if}
            {if count($good) > 0}
            <div class="layui-fluid">
                <div class="layui-row">
                    <form action="" method="post" class="layui-form layui-form-pane">
                        <div class="layui-card layui-form" lay-filter="component-form-element">
                            <div class="layui-card-header">选择服务项目</div>
                            <div id="street">
                                <div class="layui-card-body layui-row layui-col-space10">
                                    <div class="layui-col-md12">
                                        {foreach $good as $s}
                                        <input type="checkbox" value="{$s.id}" title="{$s.title}" name="goodsid[]"
                                            lay-skin="primary" {if !empty($row.goodsid) && in_array($s.id,
                                            $row.goodsid)} checked {/if}>
                                        {/foreach}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-card layui-form" lay-filter="component-form-element">
                            <div class="layui-card-header">状态</div>
                            <div class="layui-card-body layui-row layui-col-space10">
                                <div class="layui-col-md12">
                                    <input type="radio" name="status" value="1" {if !empty($row.status) &&
                                        $row.status==1}checked{/if} {if empty($row.status)}checked{/if} title="待审核">
                                    <input type="radio" name="status" value="2" {if !empty($row.status) &&
                                        $row.status==2}checked{/if} {if empty($row.status)}checked{/if} title="通过">
                                    <input type="radio" name="status" value="3" {if !empty($row.status) &&
                                        $row.status==3}checked{/if} {if empty($row.status)}checked{/if} title="驳回">
                                </div>
                                <div class="layui-form-mid" style="color: #FF5722;">
                                    非通过状态下不可接单
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <input type="hidden" value="{$id|default='0'}" name="peoples" />
                            <button class="layui-btn" lay-submit="" lay-filter="add">提交</button>
                        </div>
                    </form>
                </div>
            </div>
            {/if}
            {include file="public/footer"}
            <script>
                layui.use(['form', 'layer'], function () {
                    $ = layui.jquery;
                    var form = layui.form
                        , layer = layui.layer;
                    //监听提交
                    form.on('submit(add)', function (data) {
                        //发异步，把数据提交给php
                        $.ajax({
                            type: 'post',
                            data: data.field,
                            success: function (res) {
                                if (res.status == 0) {
                                    layer.msg(res.msg, { icon: 6, time: 1000 }, function () {
                                        // 获得frame索引
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.location.reload();
                                        parent.layer.close(index);
                                    });
                                } else {
                                    layer.msg(res.msg, { icon: 2, time: 1000 });
                                }
                            }
                        });
                        return false;
                    });
                });
            </script>